// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import * as FastClick from 'fastclick'
import App from './App'
import router from './router'
import './styles/theme.styl'
import './styles/global.css'

FastClick.attach(document.body)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

router.beforeEach((to, from, next) => {
   /* 路由发生变化修改页面meta */
   if(to.meta.content){
    let head = document.getElementsByTagName('head');
    let meta = document.createElement('meta');
    meta.content = to.meta.content;
    head[0].appendChild(meta)
   }
   /* 路由发生变化修改页面title */
   if (to.meta.title) {
    document.title = to.meta.title;
   }
   next()
  });
